<?php
function lib_arclist_hotelfx(&$ctag,&$refObj)
{
	global $dsql,$PubFields,$cfg_keyword_like,$cfg_index_cache,$_arclistEnv,$envs,$_sys_globals;

	//属性处理
	$attlist="typeid|0,row|10,col|1,flag|,titlelen|30,sort|default,keyword|,innertext|,arcid|0,idlist|,channelid|0,limit|,orderway|desc,subday|0";
	FillAttsDefault($ctag->CAttribute->Items,$attlist);
	extract($ctag->CAttribute->Items, EXTR_SKIP);

	$line = $row;
	$orderby=strtolower($sort);
	if($col=='') $col = 1;
	$innertext = trim($ctag->GetInnerText());
	if($innertext=='') $innertext = GetSysTemplets("part_arclistsg.htm");

	if(empty($channelid) && isset($GLOBALS['envs']['channelid'])) {
		$channelid = $GLOBALS['envs']['channelid'];
	}
	
	if(empty($typeid) && !empty($envs['typeid'])) {
  	$typeid = $envs['typeid'];
	}
	
	if(empty($typeid) && empty($channelid))
	{
		return "No channel info!";
  }




	//列表调用字段

    $aid=$GLOBALS['envs']['aid'];

	$query = "Select fx from `#@__hotel` where aid='$aid' $limitsql";

	$md5hash = md5($query);
	$needcache = true;

	$dsql->SetQuery($query);
	$dsql->Execute("al");
	$row = $dsql->GetArray("al");
	$xc1=explode('~',$row['fx']);
	
	$xct=count($xc1);
	$artlist = "";
	$dtp2 = new DedeTagParse();
	$dtp2->SetNameSpace("field","[","]");
	$dtp2->LoadString($innertext);
	$GLOBALS['autoindex'] = 1;
	$ids = array();
	for($i=1;$i<=$line;$i++)
	{
		       if($i>=$xct) break; //如果row大于行程天数，则跳出
			  
		        $xc2=explode('|',$xc1[$i]);
			
		
               // print_r($xc2);
			
                 $row['fx_a'] = $xc2[1];
				$row['zc_a'] = $xc2[2];
				$row['chx_a'] = $xc2[3];
				$row['kd_a'] = $xc2[4];
				$row['mshij_a'] = $xc2[5];
				$row['xf_a'] = $xc2[6];
				$row['id'] = $xc2[7];
				$row['litpic_a'] = $xc2[8];
				$row['fxxx_a'] = $xc2[9];
				
				if($row['litpic_a']=='')
				{
				$row['litpic_a']='/img/no_fx_pic.jpg';
				}
				
		
				
              
				if(is_array($dtp2->CTags))
				{
					foreach($dtp2->CTags as $k=>$ctag)
					{
						if($ctag->GetName()=='array')
						{
							//传递整个数组，在runphp模式中有特殊作用
							$dtp2->Assign($k,$row);
						}
						else
						{
							if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]);
							else $dtp2->Assign($k,'');
						}
					}
					$GLOBALS['autoindex']++;
				}

				$artlist .= $dtp2->GetResult()."\r\n";
			
		
			
		
	}//loop line
	$dsql->FreeResult("al");
	
	return $artlist;
}

?>